//
//  ShowOrderImageView.m
//  YunGou
//
//  Created by macbook on 16/6/3.
//  Copyright © 2016年 macbook. All rights reserved.
//

#import "ShowOrderImageView.h"
#import <UIImageView+WebCache.h>

@implementation ShowOrderImageView

+ (CGFloat)heightWithImages:(NSString *)imageList{
    if ([imageList isEqualToString:@""]) {
        return 0;
    }return 73.5;
}

- (void)setImageWithImages:(NSString *)imageList andWidth:(CGFloat)width{
    if ([imageList isEqualToString:@""]) {
        return;
    }
    NSArray *imageArray = [imageList componentsSeparatedByString:@","];
    NSArray *array = nil;
    if (imageArray.count > 3) {
        array = [imageArray subarrayWithRange:NSMakeRange(0, 3)];
    }else{
        array = imageArray;
    }
    CGFloat space = 8;
    CGFloat imageX = 0;
    CGFloat imageY = 0;
    CGFloat imageH = self.frame.size.height;
    CGFloat imageW = imageH;
    for (NSInteger i = 0; i < array.count; i ++) {
        UIImageView *imageView = [[UIImageView alloc] init];
        [imageView sd_setImageWithURL:[NSURL URLWithString:[ImageUrl stringByAppendingString:array[i]]]];
        imageX = i * (space + imageW);
        imageView.frame = CGRectMake(imageX, imageY, imageW, imageH);
        [self addSubview:imageView];
    }
}
@end
